package com.cyzy.controller;

import com.cyzy.dto.Result;
import com.cyzy.pojo.ArtGood;
import com.cyzy.service.ArtGoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/goods")
public class ArtGoodController {
    @Autowired
    private ArtGoodService artGoodService;

    @GetMapping("/getAllGoods")
    public Result getAllDish(@RequestParam("campusId") Integer campusId){
        List<Map<String, Object>> allGood = artGoodService.getAllGood(campusId);
        System.out.println(allGood+"------23");
        return  Result.ok().data("allGood",allGood);
    }
    @GetMapping("/getGoodByGoodId")
    public Result getGoodByGoodId(@RequestParam("id") Integer id){
        ArtGood goodMes = artGoodService.getGoodByGoodId(id);
        return Result.ok().data("goodMes",goodMes);
    }
}
